{% extends 'basic.html' %}
{% block title %}添加模块{% endblock %}
{% block content %}
<div class="h4">
    <form action="{% url 'add_modules' %}" class="form-inline" method="post">
        {% csrf_token %}
        <div class="form-group">
            <label>模块:</label>
            <input class="form-control" type="text" name="module">
        </div>
        <div class="form-group">
            <label>参数:</label>
            <input class="form-control" type="text" name="param">
        </div>
        <div class="form-group">
            <input class="btn btn-primary" type="submit" value="提 交">
        </div>
    </form>
    <hr>
    <table class="table table-bordered table-striped table-hover">
        <thead class="bg-primary">
            <tr>
                <td>模块</td>
                <td>参数</td>
            </tr>
        </thead>
        <tbody>
            {% for module in modules %}
                <tr>
                    <td>{{ module.modulename }}</td>
                    <td>
                        {% for arg in module.argument_set.all %}
                            <div class="row">
                                <div class="col-sm-7">{{ arg.arg_text }}</div>
                                <div class="col-sm-5">
                                    <a class="btn btn-danger btn-xs" href="{% url 'del_arg' arg.id %}">
                                        delete
                                    </a>
                                </div>
                            </div>
                        {% endfor %}
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}
